package com.dongdong.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdong.domain.Result;
import com.dongdong.em.ResultEnum;
import com.dongdong.pojo.TbSeller;
import com.dongdong.service.TbSellerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
@Controller
@RequestMapping("seller")
public class TbSellerController {
    @Reference
    private TbSellerService tbSellerService ;

    @RequestMapping("toList")
    public String toShow(){
        return "/admin/seller";
    }


    @RequestMapping("getShow")
    @ResponseBody
    public Result getShow(String name, String nikeName, String status){
        List<TbSeller> list = tbSellerService.getShow(name,nikeName,status);
        return Result.buildResult(ResultEnum.SUCCESS).setData(list);

    }
    @RequestMapping("toUpdate")
    @ResponseBody
    public Result toUpdate(String sellerId){
        TbSeller tbSeller = tbSellerService.toUpdate(sellerId);
        return Result.buildResult(ResultEnum.SUCCESS).setData(tbSeller);
    }
    @RequestMapping("update")
    @ResponseBody

    public Result update(String sellerId,String status){
        tbSellerService.update(sellerId,status);
        return Result.buildResult(ResultEnum.SUCCESS);
    }

}
